using NUnit.Framework;




namespace FineCollection.Immutable
{
    [TestFixture]
    public class ImmSortSet_test
    {

        [Test]
        public void Test_Constructor_Sort_2()
        {
            ImmSortSet<byte> s1 = new ImmSortSet<byte>(77,33);

            Assert.IsTrue(s1.IsNotEmpty);
            Assert.IsFalse(s1.IsEmpty);
            Assert.AreEqual(2, s1.Count);

            Assert.AreEqual(33, s1.First);
            Assert.AreEqual(77, s1.Last);

            Assert.IsTrue(s1.Contains(33));
            Assert.IsTrue(s1.Contains(77));
        }


        [Test]
        public void Test_Constructor_Sort_3()
        {
            ImmSortSet<byte> s3 = new ImmSortSet<byte>(55,77,33);

            Assert.IsTrue(s3.IsNotEmpty);
            Assert.IsFalse(s3.IsEmpty);
            Assert.AreEqual(3, s3.Count);

            Assert.AreEqual(33, s3.First);
            Assert.AreEqual(77, s3.Last);

            Assert.AreEqual(33, s3[1]);
            Assert.AreEqual(55, s3[2]);
            Assert.AreEqual(77, s3[3]);

            Assert.IsTrue(s3.Contains(33));
            Assert.IsTrue(s3.Contains(55));
            Assert.IsTrue(s3.Contains(77));
        }


        [Test]
        public void Test_Constructor_Sort_5()
        {
            byte[] arr5 = new byte[] { 44, 22, 11, 55, 33 };
            ImmSortSet<byte> s5 = new ImmSortSet<byte>(arr5);

            Assert.AreEqual(5, s5.Count);

            Assert.AreEqual(11, s5[1]);
            Assert.AreEqual(22, s5[2]);
            Assert.AreEqual(33, s5[3]);
            Assert.AreEqual(44, s5[4]);
            Assert.AreEqual(55, s5[5]);

            Assert.IsTrue(s5.Contains(11));
            Assert.IsTrue(s5.Contains(22));
            Assert.IsTrue(s5.Contains(33));
            Assert.IsTrue(s5.Contains(44));
            Assert.IsTrue(s5.Contains(55));
        }


    }
}